package com.example.demo.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.example.demo.pojo.Books;


@Mapper
public interface BooksMapper {
	@Delete("DELETE  FROM `books` where name=#{value}")
	public int deleteBooksByName(String name);
	
	@Select("SELECT * FROM  `books` WHERE id=#{value}")
	public Books findBooksById(Integer id);
	
	@Insert("INSERT INTO `books`(id,name,price,number) VALUES(#{id},#{name},#{price},#{number})")
	public int  insertBooks(Books books);
	
	@Update("UPDATE `books` SET id=#{id},name=#{name},price=#{price},number=#{number} WHERE id=#{id}")
	public int updateBooks(Books books);
	
	@Select("SELECT COUNT(*)  FROM  books")
	public int countBooks();
	
}
